package com.fitso.wicket.util;

import org.apache.wicket.model.LoadableDetachableModel;

public class FitsoWicketUtils {
	/**
	 * Wraps any given Object into a {@link LoadableDetachableModel}
	 * 
	 * @param <T>
	 *            model type
	 * @param obj
	 *            the object
	 * @param type
	 *            type the object
	 * @return the object wrapped in a {@link LoadableDetachableModel}
	 */
	public static <T> LoadableDetachableModel<T> toLoadableDetachableModel(final T obj, final Class<T> type) {
		return new LoadableDetachableModel<T>() {

			@Override
			protected T load() {
				return obj;
			}

		};
	}
}
